<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <#include "../common/include_easyui.ftl">
        <#assign ctx = request.contextPath>
        <script type="text/javascript">
            var ctxPath = "${ctx}";
            function saveData() {
                var isValid = jQuery("#addForm").form('validate');
                if (!isValid) {
                    jQuery("#addForm").form('enableValidation');
                } else {
                    var saveURL = ctxPath + "/menuMgrController/addMenu?date=" + new Date() + "";
                    var paramObj = jQuery("#addForm").serializeArray();

                    //alert(jQuery("#addForm").serialize())

                    jQuery.post(saveURL, paramObj, function (responseData) {
                        var code = responseData.code;
                        if (code == "200") {
                            $.messager.confirm('提示对话框', '数据添加成功，是否继续添加?', function (flag) {
                                if (flag) {
                                    location.href = ctxPath + "/menuMgrController/preAdd/" + [[${parentMenu.menuId}]] +"";
                                } else {
                                    var parentWin = window.parent;
                                    parentWin.jQuery("#div_table").treegrid("reload");
                                    parentWin.jQuery('#dialog_div').dialog("close");
                                }
                            });
                        } else {
                            $.messager.alert('我的消息', "数据保存出错，原因 ：" + responseData.message, 'error');
                        }

                    }, "json");
                }
            }
        </script>

        <style type="text/css">


            .add-form div {
                margin-bottom: 20px;
                /* 	display: flex;
                    justify-content:center; */
            }

            .add-form div input {
                max-width: 400px;
                height: 28px;
                width: 100%;
            }

            .add-form div select {
                max-width: 400px;
                height: 28px;
                width: 100%;
            }
        </style>
    </head>

    <body>

        <form id="addForm" method="post" class="add-form">
            <input type="hidden" value="${parentMenu.menuId}" name="parentId">
            <div style="padding-left:12%;margin-top:30px;width: 80%;">
                <input class="easyui-textbox" name="menuId" value="${parentMenu.menuName}" labelAlign="right"
                       data-options="label:'父菜单：',disabled:true">
            </div>
            <div style="padding-left:12%;width: 80%;">
                <input class="easyui-textbox" name="menuId" value="${menu.menuId?c}" labelAlign="right"
                       data-options="label:'菜单ID：',required:true,readonly:true">
            </div>
            <div style="padding-left:12%;width: 80%;">
                <input class="easyui-textbox" name="grade" value="${menu.grade}" labelAlign="right"
                       data-options="label:'菜单等级：',readonly:true">
            </div>
            <div style="padding-left:12%;width: 80%;">
                <input class="easyui-textbox" name="menuName" labelAlign="right"
                       data-options="label:'菜单名称：',required:true">
            </div>
            <div style="padding-left:12%;width: 80%;">
                <input class="easyui-textbox" name="menuHref" labelAlign="right" data-options="label:'菜单链接：'">
            </div>
            <div style="padding-left:12%;width: 80%;">
                <select class="easyui-combobox" name="menuTarget" labelAlign="right"
                        data-options="label:'菜单位置：',editable:false">
                    <option value="">==请选择==</option>
                    <option value="rightFrame">右边菜单栏</option>
                    <option value="leftFrame">左边菜单栏</option>
                    <option value="topFrame">顶部菜单栏</option>
                    <option value="bottomFrame">底部菜单栏</option>
                </select>
            </div>
        </form>

    </body>
</html>
